package com.wentao.mall.dao

import com.wentao.mall.api.PointsHistory
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query

interface PointsHistoryDao : JpaRepository<PointsHistory, Int> {
    fun findByOpenId(openId: String): List<PointsHistory>

    @Query("from PointsHistory order by dateAdded desc")
    override fun findAll(): List<PointsHistory>

//    @Query("from PointsHistory order by dateAdded desc")
//    override fun findAll(pageable: Pageable): Page<PointsHistory>

    fun findByOrderByDateAddedDesc(pageable: Pageable): Page<PointsHistory>
}